<html>
<head><meta charset="utf-8"><title>Getting span of impl block from dyn trait · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Getting.20span.20of.20impl.20block.20from.20dyn.20trait.html">Getting span of impl block from dyn trait</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="243208710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Getting%20span%20of%20impl%20block%20from%20dyn%20trait/near/243208710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thomas Del Vecchio <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Getting.20span.20of.20impl.20block.20from.20dyn.20trait.html#243208710">(Jun 18 2021 at 21:08)</a>:</h4>
<p>(Apologies if any vocabulary is off here, still learning.)</p>
<p>We’re working on developing a new codegen backend for Rust at the MIR level. When codegenning a vtable, we want to give it a reasonable source location for debugging, and have decided as a temporary measure to have it point to the location of the impl block for the type-trait pair. (This doesn't always work directly, for example <code>Box&lt;dyn A + B&gt;</code>, but it will do for now.)</p>
<p>Where can we find the <code>Span</code> for the <code>impl</code> block? Is there a way of accessing it given both the concrete <code>Ty</code>pe and the trait <code>Ty</code>pe?</p>
<p>Please let me know if I can clarify anything. Thanks!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>